package com.xinxin.leetcode.problem559;

import java.util.List;

/**
 * @author ShiXinXin
 * @date 2020-01-29 22:57
 */
class Solution {
    class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    public int maxDepth(Node root) {
        if (root == null) {
            return 0;
        }
        int maxDeep = 0;
        for (Node node : root.children) {
            maxDeep = Math.max(maxDeep, maxDepth(node));
        }
        return maxDeep + 1;
    }
}
